package test.db.exposed

import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
import org.junit.jupiter.api.Test

class ExposedTest {

    @Test
    fun `test`() {
        Database.connect("jdbc:pgsql://localhost:5432/postgres", user = "postgres", password = "postgres")

        transaction {
            // print sql to std-out
            addLogger(StdOutSqlLogger)

            for (city in Cities.selectAll()) {
                println(city[Cities.name])
            }
        }
    }

    object Cities: Table() {
        val name = varchar("name", 80)
    }
}
